package com.xzh.homeliving.commodity.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Author: zhiHong
 * @CreateTime: 2024-01-28 22:05
 * @Description: 分页插件
 */
@Configuration
@EnableTransactionManagement // 开启事务
@MapperScan("com.xzh.homeliving.commodity.dao")
public class MyBatisConfig {
    // 引入分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 溢出页数，设置为第一页
        paginationInterceptor.setOverflow(true);
        // 限制单页总数最多不超过100，小于 0 不受限制
        paginationInterceptor.setLimit(100);
        return paginationInterceptor;
    }
}
